package com.cskaoyan.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @EnableWebMvc和@Configuration都是可以加在配置类上，都会使配置类生效
 * @author stone
 * @date 2022/01/05 10:25
 */
//@EnableWebMvc     →   全面接管web配置
//@Configuration    →   配置的补充
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/pic1/**").addResourceLocations("file:d:/spring/");
        registry.addResourceHandler("/pic2/**").addResourceLocations("classpath:/static/");
    }
}
